const BaseHandler = require('../base-handler');
const SystemServices = require('../../../constants').SystemServices;
const HTTP_VERBS = require('../../../constants').HTTP_VERBS;
const moment = require('moment');

class ActionApiHandler extends BaseHandler {
    get pattern() {
        return "/admin/api/getGoodlistById";
    }

    doPOST(request, response) {
        var params = request.body;
        this.Controller.getGoodlistById(params, (result) => {
            if (result.error) {
                return response.json({
                    success: false,
                    error: result.error
                });
            }
            response.json({
                success: true,
                result: result
            });
        });
    }

    setup() {
        this.registerVerb(HTTP_VERBS.GET, this.doGET);
        this.registerVerb(HTTP_VERBS.POST, this.doPOST);
    }
}

module.exports = ActionApiHandler;